package com.kid.lib.word;

public abstract class WordAction {

	private WordBean wb = null;

	public WordAction(WordBean wb) {
		this.wb = wb;
	}

	public void initBeforeReplace() {
		if (this.wb != null) {
			this.wb.startWordApp();
		}
	}

	public void destroyAfterReplace() {
		if (this.wb != null) {
			this.wb.quitWordApp();
		}
	}

	public final void doAction() {
		try {
			this.initBeforeReplace();
			this.execute();
		} finally {
			this.destroyAfterReplace();
		}
	}

	public abstract void execute();

}
